mod shop;
mod user;
use shop::ShopList;
use std::io::{stdin, stdout, Write};
use user::User;

fn main() {
    let start_menu_list = [
        "\nОсновное меню:",
        "1. Магазин",
        "2. В бой",
        "3. Стата",
        "0. Выход\n",
    ];

    let user: User = User::create_user();
    user.say_hello();

    loop {
        for el in start_menu_list {
            println!("{}", el);
        }
        print!("Enter num of [MENU] >> ");
        stdout().flush().expect("err");

        let mut input = String::new();
        stdin().read_line(&mut input).expect("wrong line");
        let input: u8 = match input.trim().parse() {
            Ok(n) => n,
            Err(err) => {
                println!("{:?}", err);
                5
            }
        };

        match input {
            0 => {
                println!("exit");
                break;
            }
            1 => {
                println!("Shop");
                ShopList::shops_menu();
                // break;
            }
            2 => {
                println!("Battle");
                // break;
            }
            3 => {
                println!("Stats");
                // break;
            }
            _ => println!("Error"),
        }
    }
}
